//https://www.cnblogs.com/libin-1/p/6128903.html

export default {
    getCookie:Uts.getCookie,

    setCookie:Uts.setCookie,

    stringifyCookieValue(value) {
        return this.encode(String(value));
    },

    encode(s) {
        return encodeURIComponent(s);
    },

    decode(s) {
        return decodeURIComponent(s);
    },

    clearAllCookiesAndStorage:Uts.clearAllCookiesAndStorage,

    cookiesMap: function() {
        var cookies = document.cookie ? document.cookie.split("; ") : [];
        var result = {};
        for (var i = 0, l = cookies.length; i < l; i++) {
            var parts = cookies[i].split("=");
            var name = this.decode(parts.shift());
            var cookie = parts.join("=");
            result[name] = cookie;
        }

        return result;
    }
};
